<template>
<tbody>
  <tr v-for="(item,index) in goodList" :key="index">
    <td><input type="checkbox" :checked="item.checked" @change="changeFn(item.name)" /></td>
    <td>{{ item.name }}</td>
    <td>{{ item.price }}</td>
    <td>
      <button @click="minus(item.name)">-</button> {{ item.num }}
      <button @click="plus(item.name)">+</button>
    </td>
    <td>{{ item.price * item.num }}</td>
    <td><button @click="del(item.name)">删除</button></td>
  </tr>
  </tbody>
</template>

<script>
export default {
  props: {
    goodList:{
      type:Array
    }
  },
  methods:{
    del(name){
      this.$emit('del',name)
    },
    minus(name){
      this.$emit('minus',name)
    },
    plus(name){
      this.$emit('plus',name)
    },
    changeFn(name){
      this.$emit('change',name)
    }
  }
}
</script>

<style></style>
